package com.ruoyi.system.service.impl;

import java.time.LocalDate;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.OutPutExcel;
import com.ruoyi.system.domain.YuYueCount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HysYuyueMapper;
import com.ruoyi.system.domain.HysYuyue;
import com.ruoyi.system.service.IHysYuyueService;

/**
 * zzService业务层处理
 *
 * @author ruoyi
 * @date 2025-09-25
 */
@Service
public class HysYuyueServiceImpl implements IHysYuyueService {
    @Autowired
    private HysYuyueMapper hysYuyueMapper;

    /**
     * 查询zz
     *
     * @param id zz主键
     * @return zz
     */
    @Override
    public HysYuyue selectHysYuyueById(Long id) {
        return hysYuyueMapper.selectHysYuyueById(id);
    }

    /**
     * 查询zz列表
     *
     * @param hysYuyue zz
     * @return zz
     */
    @Override
    public List<HysYuyue> selectHysYuyueList(HysYuyue hysYuyue) {
        return hysYuyueMapper.selectHysYuyueList(hysYuyue);
    }

    /**
     * 新增zz
     *
     * @param hysYuyue zz
     * @return 结果
     */
    @Override
    public int insertHysYuyue(HysYuyue hysYuyue) {
        hysYuyue.setCreateTime(DateUtils.getNowDate());
        return hysYuyueMapper.insertHysYuyue(hysYuyue);
    }

    /**
     * 修改zz
     *
     * @param hysYuyue zz
     * @return 结果
     */
    @Override
    public int updateHysYuyue(HysYuyue hysYuyue) {
        hysYuyue.setUpdateTime(DateUtils.getNowDate());
        return hysYuyueMapper.updateHysYuyue(hysYuyue);
    }

    /**
     * 批量删除zz
     *
     * @param ids 需要删除的zz主键
     * @return 结果
     */
    @Override
    public int deleteHysYuyueByIds(Long[] ids) {
        return hysYuyueMapper.deleteHysYuyueByIds(ids);
    }

    /**
     * 删除zz信息
     *
     * @param id zz主键
     * @return 结果
     */
    @Override
    public int deleteHysYuyueById(Long id) {
        return hysYuyueMapper.deleteHysYuyueById(id);
    }


     /**
      * 统计每个科室的预约次数
      *
      * @return 每个科室的预约次数集合
      */
     @Override
     public List<YuYueCount> countYuyueByDepartment() {
         return hysYuyueMapper.countYuyueByDepartment();
     }

      /**
       * 统计每个科室的预约的审批中次数
       *
       * @return 每个科室的预约的审批中次数集合
       */
      @Override
      public List<YuYueCount> countYuyueByDepartmentAndState1() {
          return hysYuyueMapper.countYuyueByDepartmentAndState1();
      }
       /**
        * 统计每个科室的预约的通过次数
        *
        * @return 每个科室的预约的通过次数集合
        */
       @Override
       public List<YuYueCount> countYuyueByDepartmentAndState2() {
           return hysYuyueMapper.countYuyueByDepartmentAndState2();
       }

       /**
        * 统计每个科室的预约的拒绝次数
        *
        * @return 每个科室的预约的拒绝次数集合
        */
       @Override
       public List<YuYueCount> countYuyueByDepartmentAndState3() {
           return hysYuyueMapper.countYuyueByDepartmentAndState3();
       }


       /**
        * 根据传过来的状态列表，统计每个科室的预约的次数
        *
        * @return 每个科室的预约的次数集合
        */
       @Override
       public List<YuYueCount> countYuyueByDepartmentAndState4(String[] status) {
           return hysYuyueMapper.countYuyueByDepartmentAndState4(status);
       }


       /**
        * 根据传过来的startDate和endDate，统计这个区间内的会议日期
        * @param startDate 开始日期
        * @param endDate 结束日期
        * @return 这个区间内的会议日期集合
        */
       @Override
       public List<LocalDate> tongjiriqi(LocalDate startDate, LocalDate endDate) {
           return hysYuyueMapper.tongjiriqi(startDate, endDate);
       }

       /**
        * 查询所有的待审批的预约
        *
        * @return 所有的待审批的预约集合
        */
       @Override
       public List<HysYuyue> selectAllPendingAudit() {
           return hysYuyueMapper.selectAllPendingAudit();
       }


       /**
        * 根据前端传过来的id,status值，管理员用来审批待审批预约
        * @param hysYuyue 待审批预约实体类
        * @return 操作结果
        */
       @Override
       public int audit(HysYuyue hysYuyue) {
           return hysYuyueMapper.audit(hysYuyue);
       }


       /**
        * 统计每个取消的预约的拒绝次数，取消的状态码为4
        * @return 每个科室的取消预约的拒绝次数集合
        */
       @Override
       public List<YuYueCount> countQuxiaoState4() {
           return hysYuyueMapper.countQuxiaoState4();
       }


       /**
        * 导出预约数据
        * @param hysYuyue 导出预约实体类
        * @return 预约数据集合
        */
       @Override
       public List<OutPutExcel> export(HysYuyue hysYuyue) {
           return hysYuyueMapper.export(hysYuyue);
       }
}
